package Routes

/**
 * Created by Goland
 * User: wkk alisleepy@hotmail.com
 * Time: 2021/12/17 - 02:08
 * Desc: <Admin模块的路由信息>
 */

import (
	"ali-hr/Http/Controller/Admin"
	"ali-hr/Services/MiddleWare"
	"github.com/gin-gonic/gin"
)

// InitAdminRoutes 返回Admin模块的路由信息
func InitAdminRoutes(r *gin.Engine) {
	r.Use(MiddleWare.Cors())

	// 登录
	r.POST("/login", Admin.Login)

	// 使用jwt中间件
	adminGroup := r.Group("/admin").Use(MiddleWare.JWTAuth())
	{
		// 添加管理员
		adminGroup.POST("/create", Admin.Create)
		// 更新管理员
		adminGroup.POST("/update", Admin.Update)
		// 删除
		adminGroup.POST("/delete", Admin.Delete)
		// 开启/禁用
		adminGroup.POST("/change_status", Admin.ChangeStatus)
	}
}
